import { http } from "@/utils/http";

export type commonResult<T> = {
  code: number;
  msg: string;
  result: T;
};

export type infoType = {

	id?: number,
  unityId?:any,
	userId?: number,
	userName?: string,
	familyName?: string,
	city?: string,
	address?: string,
  lat:any,
  lng:any
}
export type infoTypeList = {
  data: infoType[];
  total: number;
};

const List = '/system/system/v2/family/familys';
const Url = '/system/system/v2/family/family';
export const getList = (params?: object) => {
  return http.request<commonResult<infoTypeList>>("get", List, {
    params
  });
};
export const getInfo = (params?: object) => {
  return http.request<commonResult<infoType>>("get", Url, {
    params
  });
};
export const addInfo = (data?: object) => {
  return http.request<commonResult<any>>("post", Url, {
    data
  });
};
export const editInfo = (data?: object) => {
  return http.request<commonResult<any>>("put", Url, {
    data
  });
};
export const deleteInfo = (data?: object) => {
  return http.request<commonResult<any>>("delete", Url, {
    data
  });
};
/** 1.2.13.6 查询家庭(下拉选择框) */
export const getFamilySelectList = (params?: object) => {
  return http.request<commonResult<any>>("get", '/system/system/v2/family/family-list', {
    params
  });
};

/** 1.2.13.7 根据家庭id查询房间 */
export const getRoomSelectList = (params?: object) => {
  return http.request<commonResult<any>>("get", '/system/system/v2/family/rooms', {
    params
  });
};


/** 1.10.1.12下载导入模板 */
export const download = (params?: object) => {
  return http.request<commonResult<any>>("get", '/system/personal/device/v2/down-load', {
    params
  });
};